AMD/IOMMU: allow use of superpage mappings
authorJan Beulich <jbeulich@suse.com>
Mon, 25 Jul 2022 13:35:40 +0000 (15:35 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 25 Jul 2022 13:35:40 +0000 (15:35 +0200)
commit4b7c48b4ba0e9b0c6ab3d680112d011e1767ee71
tree7f24d376dc72589de9a77f5e7cfc98ade890d423
parent6fc03330cdee0286290c650eb0d6fa1fc7778e79
AMD/IOMMU: allow use of superpage mappings

No separate feature flags exist which would control availability of
these; the only restriction is HATS (establishing the maximum number of
page table levels in general), and even that has a lower bound of 4.
Thus we can unconditionally announce 2M and 1G mappings. (Via non-
default page sizes the implementation in principle permits arbitrary
size mappings, but these require multiple identical leaf PTEs to be
written, which isn't all that different from having to write multiple
consecutive PTEs with increasing frame numbers. IMO that's therefore
beneficial only on hardware where suitable TLBs exist; I'm unaware of
such hardware.)

Note that in principle 512G and 256T mappings could also be supported
right away, but the freeing of page tables (to be introduced in
subsequent patches) when replacing a sufficiently populated tree with a
single huge page would need suitable preemption, which will require
extra work.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Paul Durrant <paul@xen.org>
xen/drivers/passthrough/amd/iommu_map.c
xen/drivers/passthrough/amd/pci_amd_iommu.c
xen/include/xen/page-defs.h